﻿CREATE PROCEDURE eCitizen_Personalised.usp_InsertEmailLog
@AgencyServiceCode varchar(10),
@ProcessedDateTime DateTime,
@TotalSuccessful int,
@TotalFailure int
AS
BEGIN

	DECLARE @ServiceId INT
	
	SELECT @ServiceId = ServiceId from eCitizen_Personalised.Service where AgencyCode = @AgencyServiceCode
	
	Insert into eCitizen_Personalised.[EmailLog]
	(ServiceId,ProcessedDateTime,TotalSuccessful,TotalFailure,CreatedDate,Createdby)
	Values
	(@ServiceId,@ProcessedDateTime,@TotalSuccessful,@TotalFailure,GETDATE(),'System')
END